<template>
    <div>
        <div class="picbox">
            <ul v-for="(sha,index) in share_list" :key="index">
                <li data-scroll-reveal="enter bottom over 1s"><a :href="sha.share_action"><i><img
                    :src="sha.share_img_url"></i>
                    <div class="picinfo">
                        <h3>{{sha.share_title}}</h3>
                        <span>{{sha.share_content}}</span></div>
                </a></li>
            </ul>
        </div>

        <page :total="total" @pageChange="pageChange"></page>

    </div>
</template>

<script>
    import {getPhotoList} from "../service/getData";

    export default {
        name: "share",
        data() {
            return {
                share_list: [
                    {
                        share_id: 2001,
                        share_title: '测试标题',
                        share_img_url: 'images/2.jpg',
                        share_content: '内容',
                        share_action: '/infopic/2001'
                    }, {
                        share_id: 2001,
                        share_title: '测试标题',
                        share_img_url: 'images/2.jpg',
                        share_content: '内容',
                        share_action: '/infopic/2001'
                    }, {
                        share_id: 2001,
                        share_title: '测试标题',
                        share_img_url: 'images/2.jpg',
                        share_content: '内容',
                        share_action: '/infopic/2001'
                    }, {
                        share_id: 2001,
                        share_title: '测试标题',
                        share_img_url: 'images/2.jpg',
                        share_content: '内容',
                        share_action: '/infopic/2001'
                    }, {
                        share_id: 2001,
                        share_title: '测试标题',
                        share_img_url: 'images/2.jpg',
                        share_content: '内容',
                        share_action: '/infopic/2001'
                    }, {
                        share_id: 2001,
                        share_title: '测试标题',
                        share_img_url: 'images/2.jpg',
                        share_content: '内容',
                        share_action: '/infopic/2001'
                    }, {
                        share_id: 2001,
                        share_title: '测试标题',
                        share_img_url: 'images/2.jpg',
                        share_content: '内容',
                        share_action: '/infopic/2001'
                    }, {
                        share_id: 2001,
                        share_title: '测试标题',
                        share_img_url: 'images/2.jpg',
                        share_content: '内容',
                        share_action: '/infopic/2001'
                    }
                ],
                total: 1,
                currval: 2,
            }
        },
        methods: {
            get_share: function () {
                getPhotoList(this.currval).then((res) => {
                    this.share_list = res.data.content;
                    this.total = res.data.totalPages;
                })
            },
            pageChange: function (item) {
                this.currval = item.pageCurrent;
            },
        }, mounted() {
            this.get_share();
        }
    }
</script>
